package school;

public class Teacher extends Person {
    private String title;
    private Course course;

    public Teacher(String teacherId, String name, String gender, String title) {
        super(teacherId, name, gender);
        this.title = title;
    }

    // 教师开课方法（保持不变）
    public Course openCourse(String courseId, String courseName, String location, String time, int credit) {
        this.course = new Course(courseId, courseName, location, time, credit, this);
        System.out.println(name + "（" + title + "）开设了课程《" + courseName + "》");
        return this.course;
    }

    // 重写打印方法，添加教师特有信息
    @Override
    public void printInfo() {
        super.printInfo(); // 调用父类方法打印基本信息
        System.out.println("职称：" + title);
        if (course != null) {
            System.out.println("授课课程：《" + course.getCourseName() + "》");
        } else {
            System.out.println("授课课程：暂无");
        }
        System.out.println("===================\n");
    }

    // Getter方法
    public String getTitle() { return title; }
    public Course getCourse() { return course; }
}